#!/bin/bash
                     #this proram will work at 10:00 pm everday
number=$ find . -mtime -2 -print | wc -l 
                                # tell you how many files have been changed less than 2 days
if [ " $number " != 0 ]
then
 clear                       #clear screen
  find . -mtime -2 -print         #list the files which have been changed
  echo
  echo "${BOLD}DO you want to save the files?"  #show the title in bold
  echo "Input Y for yes and N for no:"
  read answer                      #read user choice 
  while [ "$answer" == Y -o $answer == y ]
  do
    echo "Please enter the dir : "
    read dirr
    if [ -f "${dirr##*/}" -o -d "${dirr##*/}" ] 
   then
                       #change dir to the file or dir where user want to save
newname=${dirr##*/}_ "`date "+%Y_%m_%d_%H"`".tar
    tar -cvf $newname ${dirr##*/ }
    echo "the file have been saved and put in the $newname"
echo $newname >>tfile #put the informantion to the file of tfile 
echo "well done"    
else 
    echo "input a wrong dir or the file have not been "
    echo "Any more to save? Y for yes and N for no:"
    read answer
    case $answer in
     [Yy]*) $answer=Y ;;
     [Nn]*) $answer=N ;;
    esac                      #end of the case construct
    fi
   done                        #end of the while construct  
else
    echo "There is no newer files"
fi
exit                        #exit the program


